package com.etc.dingdan.controller;

import com.etc.core.pojo.CodeMessage;
import com.etc.core.service.ServiceException;
import com.etc.dingdan.service.DingDanService;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestController
public class DingdanController {

    @Autowired
    DingDanService service;

    @GetMapping("adddingdan")
    public CodeMessage addingdan(Integer id) {

        try {
            service.insertDingdan(id);
        } catch (ServiceException e) {
            e.printStackTrace();
            return CodeMessage.fail(e.getMessage());
        }


        return CodeMessage.success();

    }
}
